import ServiceBase from './ServiceBase.js'

class HttpService extends ServiceBase{
  constructor(){
    super()
    this.$$path={
      userStatus:'api/account',
      userRegister:'api/account',
      token:'token',
      dish:'api/dish',
      orderSubmit:'api/order',
      orderDetail:'api/order',
      orderList:'api/order',
      orderPay:'api/pay'
    }
  }

  //获取用户登录状态
  userStatus(param){
    return this.getRequest(this.$$path.userStatus,param)
  }

  //用户注册
  userRegister(param){
    debugger
    return this.postRequest(this.$$path.userRegister,param)
  }

  //获取token
  token(param){
    return this.postRequest(this.$$path.token,param)
  }
  // 获取菜品数据
  dish(){
    return this.getRequest(this.$$path.dish)
  }
  // 订单提交
  orderSubmit(param){
    return this.postRequest(this.$$path.orderSubmit,param)
  }

  // 订单详情
  orderDetail(param){
    return this.getRequest(this.$$path.orderDetail,param)
  }

  orderList(){
    return this.getRequest(this.$$path.orderList)
  }

  // 订单支付
  orderPay(param){
    return this.postRequest(this.$$path.orderPay,param)
  }
}

export default HttpService